package com.fance.service;

import com.fance.dao.CommentDAO;
import com.fance.model.Comment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author fance
 * @date 18-5-6 上午9:47
 */
@Service
public class CommentService {
    @Autowired
    private CommentDAO commentDAO;

    public List<Comment> getCommentsByEntity(int entityId, int entityType) {
        return commentDAO.selectByEntity(entityId,entityType);
    }

    public int addComment(Comment comment) {
        return commentDAO.addComment(comment);
    }

    public int getCommentCount(int entityId, int entityType) {
        return commentDAO.getCommentCount(entityId,entityType);
    }


    public int deleteComment(int entityId, int entityType) {
       return commentDAO.updateStatus(entityId,entityType,1);
    }
}
